<template>
	<view>
		<!-- <uni-nav-bar left-icon="back" @clickLeft="goBack" @clickRight="backRight" right-text="新建" title="配件申请"></uni-nav-bar> -->
		<view class="">
			<v-tabs v-model="activeTab"  bgColor="#F0F3F6"  :fixed="true" :lineScale="0.2" :scroll="false" :tabs="tabs" @change="getList($event,true)" activeFontSize="32rpx" fontSize="30rpx" field="title" fieNum="count"></v-tabs>
		</view>
		<view class="" v-if="recordList.length > 0" >
			<uni-card v-for="(item,index) in recordList" :key="index">
				<view class="record" @click="navRouter(`/pages/gird/farts/rejectDetail/rejectDetail?partId=${item.partId}&types=${activeTab}`)">
					<view class="record-address">
						<text>{{item.partName}}</text>
						<text v-if="item.auditStatus == 0" class="blue">待审批</text>
						<text v-else-if="item.auditStatus == 1" class="green">通过</text>
						<text v-else-if="item.auditStatus == 2" class="red">驳回</text>
					</view>
					<view class="information">
						<!-- left -->
						<view class="information-left">
							<view class="record-time">
								<view class="">申请人:</view>
								<text>{{item.receivePeople}}</text>
							</view>
							<view class="record-time">
								<view class="">申请时间:</view>
								<text>{{item.receiveDate}}</text>
							</view>
						</view>
					</view>

				</view>
			</uni-card>
		</view>
		<view v-else>
			<null-page></null-page>
		</view>
		
		<view class="addBottom" @click="navRouter(`/pages/gird/AccessoriesFor/AccessoriesFor?types=${activeTab}`)">
			<image style="width: 20px;height: 20px;padding: 20px;" src="/static/img/detailsMsg/new.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	import nullPage from '@/common/null.vue'
	import fault from "../../../serve/api/fault.js"
	export default {
		components:{
			nullPage
		},
		data() {
			return {
				activeTab: 0,
				tabs: [],

				// 内容
				recordList: [],
				getListFlag:true,
				pageNum:1,
				
			}
		},
		onLoad(){
			this.getHeadNav()
			this.getList(0)
		},
		methods: {
			async getHeadNav(){
				const res = await fault.queryApplicationListCount({})
				this.tabs = res.data.data
			},
	
			
			async getList(index, flag) {
				if (flag) {
					this.recordList = [];
					this.pageNum = 1;
					this.getListFlag = true;
				}
				const res = await fault.selectPartApplicationList({
					reviewType: Number(index),
					pageNum: this.pageNum,
					pageSize: 10,
				});
				if (res.data.data.list.length < 10) {
					this.getListFlag = false;
				}
				this.recordList.push(...res.data.data.list)
			},
		},
		onReachBottom(e) {
			if (this.getListFlag) {
				this.pageNum = this.pageNum + 1;
				this.getByStatus(this.activeTab);
			}
		}
	}
</script>

<style scoped>
	.uni-icons {
		color: #3AC211;
	}

	.uni-card {
		width: 670rpx;
		/* height: 280rpx; */
		background: #FFFFFF;
		box-shadow: 0rpx 10rpx 10rpx 0rpx rgba(52, 54, 61, 0.05);
		border-radius: 16rpx;
		margin: 0 auto;
		margin-top: 20rpx;
		border: none;
		line-height: 280rpx;
		text-align: left;
	}

	.record {
		font-family: PingFang SC;
		font-weight: 400;
		/* margin: 40rpx 0; */
	}

	.record-address {
		font-size: 30rpx;
		color: #34363D;
		display: flex;
		justify-content: space-between;
		margin-bottom: 10rpx;
	}

	.record-address .blue {
		color: #017EFE;
	}
	.record-address .green {
		color: #3AC211;
	}
	.record-address .red {
		color: #FF5753;
	}

	
	/* 左右 信息*/
	.information {
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: nowrap;
	}

	.record-time {
		font-size: 24rpx;
		color: #989BA6;
		display: flex;
		margin-top: 20rpx;
	}
	
	.record-time view{
		width: 130rpx;
		font-size: 24rpx;
	}
	.record-time text {
		margin-left: 15rpx;
		color: #34363D;
		word-spacing: 15rpx;
		letter-spacing: 1rpx;
	}

	.successState {
		background: #65D0D5;
		width: 150rpx;
		height: 60rpx;
		text-align: center;
		box-shadow: 0px 5px 10px 0px rgba(58, 194, 17, 0.2);
		border-radius: 28rpx;
		color: #FFFFFF;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;

	}

	.successState image {
		width: 30rpx;
		height: 30rpx;
		background: #65D0D5;
		border-radius: 10rpx;
	}

	.successState text {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		margin-left: 10rpx;
	}

	.addBottom {
		background-color: #007AFF;
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 999;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		position: fixed;
		right: 20px;
		bottom: 80px;
	}
</style>
